home *** CD-ROM | disk | FTP | other *** search
/ AOL File Library: 2,801 to 2,900 / aol-file-protocol-4400-2801-to-2900.zip / AOLDLs / C++ Files Library / Acere (PowerPlant, Game) 1.2 / AcereÄ.sit / Acereƒ / Code / CardDeck.h < prev    next >
C/C++ Source or Header  |  1995-03-05  |  2KB  |  98 lines

  1. #pragma once
  2.  
  3. #include <LPane.h>
  4. #ifndef __QDOFFSCREEN__
  5. #include <QDOffscreen.h>
  6. #endif
  7.  
  8. #include "CardDragTask.h"
  9.  
  10. #define    NumCards    52
  11. #define    NumSuits    4
  12. #define    NumCardsPerSuit    13
  13.  
  14. #define     blackCard        true
  15. #define    redCard        false
  16.  
  17. #define    kStubHeight 18
  18.  
  19.  
  20. class CardWell;
  21.  
  22. typedef struct CardStruct
  23. {
  24.     short    suit;
  25.     short    card;
  26.     Boolean    color;
  27.     CardWell    *itsOwner;
  28. } CardStruct;
  29.  
  30.  
  31. class PlayingCard : public LPane
  32. {
  33. public:
  34.                     short    suit;
  35.                     short    card;
  36.                     Boolean    color;
  37.                     CardWell    *itsOwner;
  38.                     
  39.     //    stuff added later;
  40.                     short    itsPosition;
  41.     
  42.                     PlayingCard(CardStruct *theStruct /*, LView *itsSuperView */);
  43.     virtual             ~PlayingCard();
  44.  
  45.     virtual    void        FillDataStruct(CardStruct *theStruct);
  46. //    virtual    void        CopyCard(PlayingCard *theStruct);
  47.     
  48.     friend class CardDragTask;
  49. } ;
  50.  
  51. class        CardDeck
  52. {
  53. public:
  54.     Byte                theCards[NumCards];
  55.     Byte                theCardPositions[NumCards];
  56.     
  57.     CIconHandle        suitCIcons[NumSuits];
  58.     
  59.     short            columnOffsets[3];
  60.     
  61. private:
  62.     short            nextCardPosition;
  63.     
  64.     GWorldPtr            cardGWorld;
  65.     PixMapHandle        offScreen, onScreen;
  66.     Rect                gwRect;
  67.     CGrafPtr            mSavePort;
  68.     GDHandle            mSaveDevice;
  69.     
  70.     RgnHandle            fullCardMask;
  71.     RgnHandle            shortCardMask;
  72.  
  73. public:
  74.                     CardDeck();
  75.     virtual             ~CardDeck();
  76.     
  77.     virtual    void        GenerateNewDeck(Boolean doOffScreenDraw);
  78.     virtual    void        ZapOldDeck();
  79.     
  80.     virtual    void        DrawCard(PlayingCard *whichCard, Rect theRect, Boolean highlight);
  81.     virtual    void        DrawCardOffScreen(CardStruct *whichCard, Rect theRect, Boolean highlight);
  82.     virtual    void        CalcOffScreenRect(PlayingCard *whichCard, Rect *theRect);
  83.     virtual    void        CalcOffScreenRect(CardStruct *whichCard, Rect *theRect);
  84. //    virtual    void        DrawShortCardBoundary(Rect theRect);
  85.     virtual    void        GetShortCardMask(void);
  86.     virtual    short    GetNextCardPosition(void);
  87.     virtual    short    GetPositionValue(short whichPosition);
  88.  
  89.     virtual    short    GetCardWidth(void);
  90.     virtual     short    GetCardHeight(void);
  91.                     
  92.     virtual    void        GetCardInfo(short whichCard, CardStruct *cardInfo);
  93.     virtual    void        GetCardInfo(short whichCard, PlayingCard *cardInfo);
  94. } ;
  95.  
  96. void        SizeRect(Rect *theRect, short width, short height);
  97. short    GetRowOffset(short whichRow, short numRows);
  98.